3.5.91 \(\int (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^n \, dx\) [491]

Optimal. Leaf size=156 \[ \frac {8 i a^3 (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-3+n}}{d (5-n) \left (12-7 n+n^2\right )}+\frac {4 i a^2 (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-2+n}}{d \left (20-9 n+n^2\right )}+\frac {i a (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-1+n}}{d (5-n)} \]

[Out]

8*I*a^3*(e*sec(d*x+c))^(6-2*n)*(a+I*a*tan(d*x+c))^(-3+n)/d/(-n^3+12*n^2-47*n+60)+4*I*a^2*(e*sec(d*x+c))^(6-2*n
)*(a+I*a*tan(d*x+c))^(-2+n)/d/(n^2-9*n+20)+I*a*(e*sec(d*x+c))^(6-2*n)*(a+I*a*tan(d*x+c))^(-1+n)/d/(5-n)

________________________________________________________________________________________

Rubi [A]
time = 0.17, antiderivative size = 156, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 30, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.067, Rules used = {3575, 3574} \begin {gather*} \frac {8 i a^3 (a+i a \tan (c+d x))^{n-3} (e \sec (c+d x))^{6-2 n}}{d (5-n) \left (n^2-7 n+12\right )}+\frac {4 i a^2 (a+i a \tan (c+d x))^{n-2} (e \sec (c+d x))^{6-2 n}}{d \left (n^2-9 n+20\right )}+\frac {i a (a+i a \tan (c+d x))^{n-1} (e \sec (c+d x))^{6-2 n}}{d (5-n)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(e*Sec[c + d*x])^(6 - 2*n)*(a + I*a*Tan[c + d*x])^n,x]

[Out]

((8*I)*a^3*(e*Sec[c + d*x])^(6 - 2*n)*(a + I*a*Tan[c + d*x])^(-3 + n))/(d*(5 - n)*(12 - 7*n + n^2)) + ((4*I)*a
^2*(e*Sec[c + d*x])^(6 - 2*n)*(a + I*a*Tan[c + d*x])^(-2 + n))/(d*(20 - 9*n + n^2)) + (I*a*(e*Sec[c + d*x])^(6
 - 2*n)*(a + I*a*Tan[c + d*x])^(-1 + n))/(d*(5 - n))

Rule 3574

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[2*b*(
d*Sec[e + f*x])^m*((a + b*Tan[e + f*x])^(n - 1)/(f*m)), x] /; FreeQ[{a, b, d, e, f, m, n}, x] && EqQ[a^2 + b^2
, 0] && EqQ[Simplify[m/2 + n - 1], 0]

Rule 3575

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b*(d*
Sec[e + f*x])^m*((a + b*Tan[e + f*x])^(n - 1)/(f*(m + n - 1))), x] + Dist[a*((m + 2*n - 2)/(m + n - 1)), Int[(
d*Sec[e + f*x])^m*(a + b*Tan[e + f*x])^(n - 1), x], x] /; FreeQ[{a, b, d, e, f, m, n}, x] && EqQ[a^2 + b^2, 0]
 && IGtQ[Simplify[m/2 + n - 1], 0] &&  !IntegerQ[n]

Rubi steps

\begin {align*} \int (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^n \, dx &=\frac {i a (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-1+n}}{d (5-n)}+\frac {(4 a) \int (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-1+n} \, dx}{5-n}\\ &=\frac {4 i a^2 (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-2+n}}{d \left (20-9 n+n^2\right )}+\frac {i a (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-1+n}}{d (5-n)}+\frac {\left (8 a^2\right ) \int (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-2+n} \, dx}{20-9 n+n^2}\\ &=\frac {8 i a^3 (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-3+n}}{d (3-n) \left (20-9 n+n^2\right )}+\frac {4 i a^2 (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-2+n}}{d \left (20-9 n+n^2\right )}+\frac {i a (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-1+n}}{d (5-n)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 2.35, size = 122, normalized size = 0.78 \begin {gather*} -\frac {e^6 \sec ^5(c+d x) (e \sec (c+d x))^{-2 n} \left (-2 (-5+n)+\left (22-9 n+n^2\right ) \cos (2 (c+d x))+i \left (18-9 n+n^2\right ) \sin (2 (c+d x))\right ) (i \cos (3 (c+d x))+\sin (3 (c+d x))) (a+i a \tan (c+d x))^n}{d (-5+n) (-4+n) (-3+n)} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(e*Sec[c + d*x])^(6 - 2*n)*(a + I*a*Tan[c + d*x])^n,x]

[Out]

-((e^6*Sec[c + d*x]^5*(-2*(-5 + n) + (22 - 9*n + n^2)*Cos[2*(c + d*x)] + I*(18 - 9*n + n^2)*Sin[2*(c + d*x)])*
(I*Cos[3*(c + d*x)] + Sin[3*(c + d*x)])*(a + I*a*Tan[c + d*x])^n)/(d*(-5 + n)*(-4 + n)*(-3 + n)*(e*Sec[c + d*x
])^(2*n)))

________________________________________________________________________________________

Maple [F]
time = 0.84, size = 0, normalized size = 0.00 \[\int \left (e \sec \left (d x +c \right )\right )^{6-2 n} \left (a +i a \tan \left (d x +c \right )\right )^{n}\, dx\]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((e*sec(d*x+c))^(6-2*n)*(a+I*a*tan(d*x+c))^n,x)

[Out]

int((e*sec(d*x+c))^(6-2*n)*(a+I*a*tan(d*x+c))^n,x)

________________________________________________________________________________________

Maxima [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 865 vs. \(2 (143) = 286\).
time = 1.74, size = 865, normalized size = 5.54 \begin {gather*} -\frac {32 \, {\left ({\left (a^{n} n^{2} e^{6} - 9 \, a^{n} n e^{6} + 20 \, a^{n} e^{6}\right )} {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{2} \, n} \cos \left (4 \, d x + n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right ) + 4 \, c\right ) - 2 \, {\left (a^{n} n e^{6} - 5 \, a^{n} e^{6}\right )} {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{2} \, n} \cos \left (2 \, d x + n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right ) + 2 \, c\right ) + 2 \, a^{n} \cos \left (n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right )\right ) e^{\left (\frac {1}{2} \, n \log \left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right ) + 6\right )} - {\left (-i \, a^{n} n^{2} e^{6} + 9 i \, a^{n} n e^{6} - 20 i \, a^{n} e^{6}\right )} {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{2} \, n} \sin \left (4 \, d x + n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right ) + 4 \, c\right ) - 2 \, {\left (i \, a^{n} n e^{6} - 5 i \, a^{n} e^{6}\right )} {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{2} \, n} \sin \left (2 \, d x + n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right ) + 2 \, c\right ) + 2 i \, a^{n} e^{\left (\frac {1}{2} \, n \log \left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right ) + 6\right )} \sin \left (n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right )\right )\right )}}{{\left ({\left (-i \, n^{3} + 12 i \, n^{2} - 47 i \, n + 60 i\right )} 2^{n} \cos \left (10 \, d x + 10 \, c\right ) e^{\left (2 \, n\right )} - 5 \, {\left (i \, n^{3} - 12 i \, n^{2} + 47 i \, n - 60 i\right )} 2^{n} \cos \left (8 \, d x + 8 \, c\right ) e^{\left (2 \, n\right )} - 10 \, {\left (i \, n^{3} - 12 i \, n^{2} + 47 i \, n - 60 i\right )} 2^{n} \cos \left (6 \, d x + 6 \, c\right ) e^{\left (2 \, n\right )} - 10 \, {\left (i \, n^{3} - 12 i \, n^{2} + 47 i \, n - 60 i\right )} 2^{n} \cos \left (4 \, d x + 4 \, c\right ) e^{\left (2 \, n\right )} - 5 \, {\left (i \, n^{3} - 12 i \, n^{2} + 47 i \, n - 60 i\right )} 2^{n} \cos \left (2 \, d x + 2 \, c\right ) e^{\left (2 \, n\right )} + {\left (n^{3} - 12 \, n^{2} + 47 \, n - 60\right )} 2^{n} e^{\left (2 \, n\right )} \sin \left (10 \, d x + 10 \, c\right ) + 5 \, {\left (n^{3} - 12 \, n^{2} + 47 \, n - 60\right )} 2^{n} e^{\left (2 \, n\right )} \sin \left (8 \, d x + 8 \, c\right ) + 10 \, {\left (n^{3} - 12 \, n^{2} + 47 \, n - 60\right )} 2^{n} e^{\left (2 \, n\right )} \sin \left (6 \, d x + 6 \, c\right ) + 10 \, {\left (n^{3} - 12 \, n^{2} + 47 \, n - 60\right )} 2^{n} e^{\left (2 \, n\right )} \sin \left (4 \, d x + 4 \, c\right ) + 5 \, {\left (n^{3} - 12 \, n^{2} + 47 \, n - 60\right )} 2^{n} e^{\left (2 \, n\right )} \sin \left (2 \, d x + 2 \, c\right ) + {\left (-i \, n^{3} + 12 i \, n^{2} - 47 i \, n + 60 i\right )} 2^{n} e^{\left (2 \, n\right )}\right )} d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((e*sec(d*x+c))^(6-2*n)*(a+I*a*tan(d*x+c))^n,x, algorithm="maxima")

[Out]

-32*((a^n*n^2*e^6 - 9*a^n*n*e^6 + 20*a^n*e^6)*(cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) +
1)^(1/2*n)*cos(4*d*x + n*arctan2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1) + 4*c) - 2*(a^n*n*e^6 - 5*a^n*e^6)*(c
os(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1)^(1/2*n)*cos(2*d*x + n*arctan2(sin(2*d*x + 2*c
), cos(2*d*x + 2*c) + 1) + 2*c) + 2*a^n*cos(n*arctan2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1))*e^(1/2*n*log(co
s(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1) + 6) - (-I*a^n*n^2*e^6 + 9*I*a^n*n*e^6 - 20*I*
a^n*e^6)*(cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1)^(1/2*n)*sin(4*d*x + n*arctan2(sin(
2*d*x + 2*c), cos(2*d*x + 2*c) + 1) + 4*c) - 2*(I*a^n*n*e^6 - 5*I*a^n*e^6)*(cos(2*d*x + 2*c)^2 + sin(2*d*x + 2
*c)^2 + 2*cos(2*d*x + 2*c) + 1)^(1/2*n)*sin(2*d*x + n*arctan2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1) + 2*c) +
 2*I*a^n*e^(1/2*n*log(cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1) + 6)*sin(n*arctan2(sin
(2*d*x + 2*c), cos(2*d*x + 2*c) + 1)))/(((-I*n^3 + 12*I*n^2 - 47*I*n + 60*I)*2^n*cos(10*d*x + 10*c)*e^(2*n) -
5*(I*n^3 - 12*I*n^2 + 47*I*n - 60*I)*2^n*cos(8*d*x + 8*c)*e^(2*n) - 10*(I*n^3 - 12*I*n^2 + 47*I*n - 60*I)*2^n*
cos(6*d*x + 6*c)*e^(2*n) - 10*(I*n^3 - 12*I*n^2 + 47*I*n - 60*I)*2^n*cos(4*d*x + 4*c)*e^(2*n) - 5*(I*n^3 - 12*
I*n^2 + 47*I*n - 60*I)*2^n*cos(2*d*x + 2*c)*e^(2*n) + (n^3 - 12*n^2 + 47*n - 60)*2^n*e^(2*n)*sin(10*d*x + 10*c
) + 5*(n^3 - 12*n^2 + 47*n - 60)*2^n*e^(2*n)*sin(8*d*x + 8*c) + 10*(n^3 - 12*n^2 + 47*n - 60)*2^n*e^(2*n)*sin(
6*d*x + 6*c) + 10*(n^3 - 12*n^2 + 47*n - 60)*2^n*e^(2*n)*sin(4*d*x + 4*c) + 5*(n^3 - 12*n^2 + 47*n - 60)*2^n*e
^(2*n)*sin(2*d*x + 2*c) + (-I*n^3 + 12*I*n^2 - 47*I*n + 60*I)*2^n*e^(2*n))*d)

________________________________________________________________________________________

Fricas [A]
time = 0.43, size = 165, normalized size = 1.06 \begin {gather*} \frac {{\left ({\left (-i \, n^{2} + 9 i \, n - 20 i\right )} e^{\left (6 i \, d x + 6 i \, c\right )} + {\left (-i \, n^{2} + 11 i \, n - 30 i\right )} e^{\left (4 i \, d x + 4 i \, c\right )} - 2 \, {\left (-i \, n + 6 i\right )} e^{\left (2 i \, d x + 2 i \, c\right )} - 2 i\right )} \left (\frac {2 \, e^{\left (i \, d x + i \, c + 1\right )}}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}\right )^{-2 \, n + 6} e^{\left (i \, d n x + i \, c n - 6 i \, d x + n \log \left (a e^{\left (-1\right )}\right ) + n \log \left (\frac {2 \, e^{\left (i \, d x + i \, c + 1\right )}}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}\right ) - 6 i \, c\right )}}{2 \, {\left (d n^{3} - 12 \, d n^{2} + 47 \, d n - 60 \, d\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((e*sec(d*x+c))^(6-2*n)*(a+I*a*tan(d*x+c))^n,x, algorithm="fricas")

[Out]

1/2*((-I*n^2 + 9*I*n - 20*I)*e^(6*I*d*x + 6*I*c) + (-I*n^2 + 11*I*n - 30*I)*e^(4*I*d*x + 4*I*c) - 2*(-I*n + 6*
I)*e^(2*I*d*x + 2*I*c) - 2*I)*(2*e^(I*d*x + I*c + 1)/(e^(2*I*d*x + 2*I*c) + 1))^(-2*n + 6)*e^(I*d*n*x + I*c*n
- 6*I*d*x + n*log(a*e^(-1)) + n*log(2*e^(I*d*x + I*c + 1)/(e^(2*I*d*x + 2*I*c) + 1)) - 6*I*c)/(d*n^3 - 12*d*n^
2 + 47*d*n - 60*d)

________________________________________________________________________________________

Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((e*sec(d*x+c))**(6-2*n)*(a+I*a*tan(d*x+c))**n,x)

[Out]

Timed out

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((e*sec(d*x+c))^(6-2*n)*(a+I*a*tan(d*x+c))^n,x, algorithm="giac")

[Out]

integrate((e*sec(d*x + c))^(-2*n + 6)*(I*a*tan(d*x + c) + a)^n, x)

________________________________________________________________________________________

Mupad [B]
time = 10.33, size = 318, normalized size = 2.04 \begin {gather*} \left (\cos \left (6\,c+6\,d\,x\right )-\sin \left (6\,c+6\,d\,x\right )\,1{}\mathrm {i}\right )\,{\left (\frac {e}{\cos \left (c+d\,x\right )}\right )}^{6-2\,n}\,\left (\frac {{\left (a+\frac {a\,\sin \left (c+d\,x\right )\,1{}\mathrm {i}}{\cos \left (c+d\,x\right )}\right )}^n}{d\,\left (n^3\,1{}\mathrm {i}-n^2\,12{}\mathrm {i}+n\,47{}\mathrm {i}-60{}\mathrm {i}\right )}-\frac {\left (2\,n-12\right )\,\left (\cos \left (2\,c+2\,d\,x\right )+\sin \left (2\,c+2\,d\,x\right )\,1{}\mathrm {i}\right )\,{\left (a+\frac {a\,\sin \left (c+d\,x\right )\,1{}\mathrm {i}}{\cos \left (c+d\,x\right )}\right )}^n}{2\,d\,\left (n^3\,1{}\mathrm {i}-n^2\,12{}\mathrm {i}+n\,47{}\mathrm {i}-60{}\mathrm {i}\right )}+\frac {\left (\cos \left (6\,c+6\,d\,x\right )+\sin \left (6\,c+6\,d\,x\right )\,1{}\mathrm {i}\right )\,{\left (a+\frac {a\,\sin \left (c+d\,x\right )\,1{}\mathrm {i}}{\cos \left (c+d\,x\right )}\right )}^n\,\left (n^2-9\,n+20\right )}{2\,d\,\left (n^3\,1{}\mathrm {i}-n^2\,12{}\mathrm {i}+n\,47{}\mathrm {i}-60{}\mathrm {i}\right )}+\frac {\left (\cos \left (4\,c+4\,d\,x\right )+\sin \left (4\,c+4\,d\,x\right )\,1{}\mathrm {i}\right )\,{\left (a+\frac {a\,\sin \left (c+d\,x\right )\,1{}\mathrm {i}}{\cos \left (c+d\,x\right )}\right )}^n\,\left (n^2-11\,n+30\right )}{2\,d\,\left (n^3\,1{}\mathrm {i}-n^2\,12{}\mathrm {i}+n\,47{}\mathrm {i}-60{}\mathrm {i}\right )}\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((e/cos(c + d*x))^(6 - 2*n)*(a + a*tan(c + d*x)*1i)^n,x)

[Out]

(cos(6*c + 6*d*x) - sin(6*c + 6*d*x)*1i)*(e/cos(c + d*x))^(6 - 2*n)*((a + (a*sin(c + d*x)*1i)/cos(c + d*x))^n/
(d*(n*47i - n^2*12i + n^3*1i - 60i)) - ((2*n - 12)*(cos(2*c + 2*d*x) + sin(2*c + 2*d*x)*1i)*(a + (a*sin(c + d*
x)*1i)/cos(c + d*x))^n)/(2*d*(n*47i - n^2*12i + n^3*1i - 60i)) + ((cos(6*c + 6*d*x) + sin(6*c + 6*d*x)*1i)*(a
+ (a*sin(c + d*x)*1i)/cos(c + d*x))^n*(n^2 - 9*n + 20))/(2*d*(n*47i - n^2*12i + n^3*1i - 60i)) + ((cos(4*c + 4
*d*x) + sin(4*c + 4*d*x)*1i)*(a + (a*sin(c + d*x)*1i)/cos(c + d*x))^n*(n^2 - 11*n + 30))/(2*d*(n*47i - n^2*12i
 + n^3*1i - 60i)))

________________________________________________________________________________________